Python Email
Getting-mail-attachment-to-python-file-object
import email in_name='' msg = email.message_from_file(open(in_name)) len(msg.get_payload()) attachment = msg.get_payload()[1] attachment.get_content_type() out_name = attachment.get_filename() open(out_name, 'wb').write(attachment.get_payload(decode=True))